import UnityEngine

class Gun (MonoBehaviour): 

    def Start ():
        pass
    
    # def Update ():
    #     ray = Camera.main.ScreenPointToRay (Vector3(Input.mousePosition.x,Input.mousePosition.y,0))
    #     Debug.DrawRay (ray.origin, ray.direction * 20, Color.yellow)
    # 
    
    def AutoFire(origin as Vector3, direction as Vector3):
        # Debug.Log("Bang")
        ray = Ray(origin, direction)
        hits = Physics.RaycastAll(ray)
        for h in hits:
            hitbox = h.collider.GetComponent(HitBox)
            if hitbox:
                hitbox.Damage(1.0)
    
    # def OnGUI():
    #     ray = Camera.main.ScreenPointToRay (Vector3(Input.mousePosition.x,Input.mousePosition.y,0))
    #     hit = Physics.Raycast(ray)
    #     if hit:
    #         GUI.Box(Rect(Input.mousePosition.x-50,Screen.height-Input.mousePosition.y+25,100,25), "Targeted!")
    # 

